class Solution {
public:
    int lengthOfLIS(vector<int>& nums) {
        vector<int>dp(nums.size(), 1);
        dp[0] = 1;
        for (int i = 1; i < nums.size(); i++)
        {
            for (int j = 0; j < i; j++)
            {
                if (nums[i] > nums[j])
                {

                    dp[i] = max(dp[i], dp[j] + 1);

                }



            }






        }
        int maxp = 0;
        for (int i = 0; i < nums.size(); i++)
        {
            maxp = max(dp[i], maxp);




        }
        return maxp;










    }
}; class Solution {
public:
    int findLengthOfLCIS(vector<int>& nums) {
        vector<int>dp(nums.size(), 1);
        dp[0] = 1;
        for (int i = 1; i < nums.size(); i++)
        {
            if (nums[i] > nums[i - 1])

                dp[i] = max(dp[i], dp[i - 1] + 1);





        }
        int maxp = 0;
        for (int i = 0; i < dp.size(); i++)
        {
            maxp = max(dp[i], maxp);


        }
        return maxp;
    }
}; class Solution {
public:
    int findLength(vector<int>& nums1, vector<int>& nums2) {
        vector<vector<int>>dp(nums1.size() + 1, vector<int>(nums2.size() + 1));
        for (int j = 0; j < nums2.size(); j++)
            dp[0][j] = 0;
        for (int j = 0; j < nums1.size(); j++)
            dp[j][0] = 0;
        int maxp = 0;
        for (int i = 1; i <= nums1.size(); i++)
        {
            for (int j = 1; j <= nums2.size(); j++)
                if (nums1[i - 1] == nums2[j - 1])
                {
                    dp[i][j] = dp[i - 1][j - 1] + 1;





                    maxp = max(maxp, dp[i][j]);
                }
        }
        return maxp;
    }
}; class Solution {
public:
    int longestCommonSubsequence(string text1, string text2) {
        int m = text1.length();
        int n = text2.length();

        vector<vector<int>>dp(m + 1, vector<int>(n + 1, 0));

        int maxp = 0;
        for (int i = 1; i <= m; i++)
        {
            for (int j = 1; j <= n; j++)
            {
                if (text1[i - 1] == text2[j - 1])
                    dp[i][j] = dp[i - 1][j - 1] + 1;
                else
                    dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);



                maxp = max(dp[i][j], maxp);
            }
        }
        return maxp;

    }
}; class Solution {
public:
    int maxUncrossedLines(vector<int>& nums1, vector<int>& nums2) {

        vector<vector<int>>dp(nums1.size() + 1, vector<int>(nums2.size() + 1, 0));
        int maxp = 0;
        for (int i = 1; i <= nums1.size(); i++)
        {
            for (int j = 1; j <= nums2.size(); j++)
            {
                if (nums1[i - 1] == nums2[j - 1])
                    dp[i][j] = dp[i - 1][j - 1] + 1;
                else
                    dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);




                maxp = max(dp[i][j], maxp);
            }





        }
        return maxp;

    }
};